<?php
/**
 * php代码执行入口函数
 * 用法： php cli.php test main
 * User: minyifei.cn
 * Date: 15/6/18
 */

require_once("core.php");

$count = count($argv);
if($count>=2){
    $controllerName = $argv[1];
    $actionName = "main";
    if(isset($argv[2])){
        $actionName = $argv[2];
    }
    $className = mb_ucfirst($controllerName)."Task";
    $fileName = APP_SITE_PATH."/app/task/".$controllerName."Task.php";
    if(file_exists($fileName)){
        include($fileName);
        $task = new $className();
        $task->_before_action();
        $task->$actionName();
        $task->_after_action();
    }
}